/* 
 * MCore Extensions for TTBlue
 * Creates a wrapper for TTAudioObjects that can be used to build an audio processing graph.
 * Copyright © 2008, Timothy Place
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#ifndef __MULTICORE_OUTPUT_H__
#define __MULTICORE_OUTPUT_H__

#include "multicore.h"


/**	MCoreOutput is an audio object that serves as the destination and master for a MCore graph.		*/
class MULTICORE_EXPORT MCoreOutput : public TTAudioObject
{
public:
	TTObjectPtr			audioEngine;
	TTAudioSignalPtr	placeHolder;	///< an unused audio signal that we pass
	MCoreObjectPtr	owner;			///< the owning lydbaer instance
	TTValuePtr			me;

	
	/**	Constructor. */
	MCoreOutput(TTValue& arguments);
	
	/**	Destructor. */
	virtual ~MCoreOutput();
	
	
	TTErr start();
	TTErr stop();
	
	/** Called by the audio engine every time a new vector of output is required. */
	TTErr audioEngineWillProcess();
	
	TTErr setOwner(TTValue& newOwner);

	
	// Attribute Accessors
	TTErr setsampleRate(const TTValue& newValue);
	TTErr getsampleRate(TTValue& returnedValue);
	TTErr setvectorSize(const TTValue& newValue);
	TTErr getvectorSize(TTValue& returnedValue);
	
	
	/**	A standard audio processing method as used by TTBlue objects.
		@param	outputs	unused.		*/
	TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);	
};

typedef MCoreOutput* MCoreOutputPtr;





#endif // __MULTICORE_OUTPUT_H__
